﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Ninject;
using Ninject.Modules;

namespace SportsStore.Domain
{
    //http://hi.baidu.com/wangzhiqing999/item/78a0dedd235ad53449e1dd2d
    public interface IHelloWorld
    {
        string HelloWorld();
    }

    public class HelloWorldEnglish:IHelloWorld
    {
        string IHelloWorld.HelloWorld()
        {
            return "Hello World";
        }
    }

    public class HelloWorldchinese:IHelloWorld
    {
        string IHelloWorld.HelloWorld()
        {
            return "你好 世界！";
        }
    }

    public class Person
    {
        private readonly IHelloWorld peopleHelloWorld;

        [Inject]
        public Person(IHelloWorld helloworld)
        {
            if (helloworld == null)
                throw new ArgumentNullException("hello world!");
            this.peopleHelloWorld = helloworld;
        }

        public void SayHello()
        {
            string hl = this.peopleHelloWorld.HelloWorld();
        }
    }

    public class MyModules1:NinjectModule
    {
        public override void Load()
        {
            //throw new NotImplementedException();
            Bind<IHelloWorld>().To<HelloWorldchinese>();
        }
    }

    public class MyModules2 : NinjectModule
    {
        public override void Load()
        {
            //throw new NotImplementedException();
            Bind<IHelloWorld>().To<HelloWorldEnglish>();
        }
    }
}
